<template>
  <div class='container'>

    <div v-show='fold' v-stretch:right class='content'>
      <h2>123456789012345</h2>

      <div class='fold-wrap' @click='handleFold'>
        <i class='el-icon-back'></i>
      </div>
    </div>

    <div v-show='!fold' class='stretch-wrap-left' @click='handleFold'>
      <i class='el-icon-right'></i>
    </div>

    <div class='center-container'
         :style="{ marginLeft: fold ? '20px' : null, marginRight: fold ? '20px' : null }">
      <h2>content content content</h2>


      <el-tooltip :disabled='disabled' content='打破沙锅问到底打破沙锅问到底打破沙锅问到底' placement='bottom'
                  effect='light'>
        <p class='single-line'>打破沙锅问到底打破沙锅问到底打破沙锅问到底</p>
      </el-tooltip>

    </div>


    <el-select v-model='value1' multiple placeholder='请选择'>
      <el-option
        v-for='item in options'
        :key='item.value'
        :label='item.label'
        :value='item.value'>
      </el-option>
    </el-select>
  </div>
</template>

<script>

export default {
  name: 'Layout',

  data() {
    return {
      options: [{
        value: '选项1',
        label: '黄金糕'
      }, {
        value: '选项2',
        label: '双皮奶'
      }, {
        value: '选项3',
        label: '蚵仔煎'
      }, {
        value: '选项4',
        label: '龙须面'
      }, {
        value: '选项5',
        label: '北京烤鸭'
      }],
      value1: [],
      fold: true,
      disabled: false,
      show: false,
      test: null
    }
  },

  created() {
    if (this.show) {
      console.log('test:', this.test)
    }


  },

  mounted() {
    setTimeout(() => {
      this.test = 'hello world '
      this.show = true

    }, 50)
  },

  methods: {
    handleFold() {
      this.fold = !this.fold
    }

  }
}
</script>

<style lang='scss' scoped>
.container {
  position: relative;
  display: flex;

  padding: 0px 0px 20px !important;
  background: #d9d9d9 !important;

  @mixin stretch {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    cursor: all-scroll;
    background: #d9d9d9;
    border-radius: 50%;
    box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease-in-out;
    transform: translateY(-50%);
    &:hover {
      transform: translateY(-50%) rotate(180deg);
    }
  }

  @mixin fold {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    color: blueviolet;
    cursor: pointer;
    background: dodgerblue;
    border-radius: 50%;
    box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
    transform: translateY(-50%);
  }

  .stretch-wrap-left {
    position: absolute;
    top: calc(50%);
    left: -15px;
    @include fold;
  }

  .stretch-wrap-right {
    position: absolute;
    top: calc(50%);
    right: -15px;
    @include fold;
  }

  .content {
    position: relative;
    display: flex;
    flex-basis: 250px;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px;
    margin-right: 25px;
    background: #d9d9d9;
    //border-radius: $base-border-radius;

    &__top {
      flex-shrink: 1;
    }

    &__bottom {
      display: flex;
      flex: 1;
      flex-direction: column;
      justify-content: flex-end;

      // background: ;
      .query-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 6px 6px;

        :deep() {
          .el-date-editor.el-input,
          .el-date-editor.el-input__inner {
            width: 100%;
            background: transparent !important;
          }

          .el-input__inner {
            color: #606266;
            background-color: transparent;
            border: 0px;
          }
        }

        &__label {
          flex: 1;
          font-size: 13px;
        }

        &__value {
          flex: 2;
          // padding: 8px 0px;
          text-align: center;
          background: #f6f8f9;
        }
      }

      :deep() {
      }

      .communication-icon-main {
        display: block;
        padding: 20px;
        margin: 0px auto;
        border-radius: 50%;
      }

      .communication-icon-sub {

        display: flex;
        align-items: center;
        justify-content: center;
        margin: 10px auto 0px;
        border-radius: 20px;
      }

      // box-shadow: -0px -20px 20px 0px rgba(0, 0, 0, 0.1);

      // box-shadow: 0px -20px 20px -20px rgba(0, 0, 0, 0.2); /* 设置阴影效果 */
    }

    &__header {
      display: flex;
      align-items: center;
      justify-content: space-between;

      &__title {
        margin-right: 40px;
        font-size: 16px;
        // font-weight: bold;
        color: mediumvioletred;
      }
    }

    .stretch-wrap {
      position: absolute;
      top: calc(50% + 40px);
      right: -15px;
      z-index: 999;
      @include stretch;
    }

    .fold-wrap {
      position: absolute;
      top: calc(50% - 10px);
      right: -15px;
      z-index: 999;
      @include fold;
    }
  }

  .center-container {
    flex: 1;
    background: #d9d9d9;
  }

  .right-container {
    position: relative;
    flex-basis: 320px;
    margin-left: 25px;
    background: #d9d9d9;

    :deep() {
      .amap-logo {
        display: none !important;
      }

      .amap-copyright {
        display: none !important;
      }
    }

    .stretch-wrap {
      position: absolute;
      top: calc(50% + 40px);
      left: -15px;
      z-index: 999;
      @include stretch;
    }

    .fold-wrap {
      position: absolute;
      top: calc(50% - 10px);
      left: -15px;
      z-index: 999;
      @include fold;
    }
  }
}

p {
  width: 20px;
  overflow: hidden;
}

.single-line {
  text-overflow: ellipsis;
  overflow: hidden;
  -webkit-line-clamp: 1;
  width: 35px;
  word-break: break-all;
  white-space: nowrap;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  cursor: pointer;
}


</style>
